home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -in_the_mag- / banging_the_metal / qdos / qdos4amiga3.lha / BLITTER_asm < prev    next >
Text File  |  1998-02-12  |  4KB  |  77 lines

  1. * BLITTER_ASM - it works ... oh, joy, QDOS with a BLITTER too!
  2. * Assembler Demo by Simon N Goodwin, December 1992-July 1993, V 0.9
  3. * Now works in FAST RAM as well as CHIP memory.
  4. *
  5. * Please note that this depends on 68000 timings and will give up
  6. * with a 'not complete' error on AGA machines and faster processors
  7. * unless you increase the loop count in D1 to make the CPU wait longer.
  8. * Real programs should get on with something else while the blitter
  9. * does its stuff, but this is just a simple demo. SNG 11-1-94
  10. *
  11. screen      equ     131072              Qdos screen start
  12. *
  13. * Chip Label names conform to "Mapping the Amiga" (Compute! Books).
  14. *
  15. hw          equ     $dff000             Base of Amiga register set
  16. sw          equ     0                   Offset for 'new' Amigas?
  17. *
  18. * Commodore may change the base address $dff000 in new hardware.
  19. *
  20. dmaconr     equ     sw+$002             DMA enable read (word)
  21. bbusy       equ     6                   Blitter busy bit in HIGH byte
  22. *
  23. start       movea.l #hw,a0              Point at custom chips
  24.             trap    #0                  Supervisor mode
  25.             or.w    #$700,sr            Disable interrupts
  26.             moveq   #127,d1             ** 0.8 ** Previously 100
  27.             moveq   #-1,d0              Count down 65536 times
  28. wait        btst    #bbusy,dmaconr(a0)
  29.             dbne    d0,wait             Loop till D0=-1 or BBUSY=0
  30.             beq.s   gotcha              Free at last, BBUSY=0
  31.             subq.b  #1,d1               Wait a while longer
  32.             beq.s   user_mode           Blitter is not free, D0=ERR.NC
  33.             bra.s   wait                Try again
  34.  
  35. * Blitter control bit assignments here refer to MOVE not DRAW mode.
  36. *
  37. bltcon0     equ     sw+$040             Blitter Control Register 0
  38. *
  39. * Minterm {0..7}, DMA on D-C-B-A {8..11} Preshift on A {12..15}
  40. *
  41. bltcon1     equ     sw+$042             Blitter Control Register 1
  42. *
  43. * Move/Draw (0/1), Up/Down (0/2), Fill {2..4}  Pre-shift on B {12..15}
  44. *
  45. gotcha      move.w  #$90F,bltcon0(a0)   Copy inverted A to DMA channel D
  46.             moveq   #0,d0               Constant Zero for later use
  47.             moveq   #-1,d7              Constant mask - all bits set
  48.             move.w  d0,bltcon1(a0)      Move progressively up memory
  49. *
  50. bltafwm     equ     sw+$044       Left mask for first word fetched
  51. bltalwm     equ     sw+$046       Right mask for last word fetched on A
  52. bltcpt      equ     sw+$048       Blitter channel C source pointer (LONG)
  53. bltbpt      equ     sw+$04C       Blitter channel B source pointer (LONG)
  54. bltapt      equ     sw+$050       Blitter channel A source pointer (LONG)
  55. bltdpt      equ     sw+$054       Blitter channel D destination pointer (LONG)
  56. bltsize     equ     sw+$058       Blit size; word width {0..5} height {6..15}
  57. *
  58.             move.l  d7,bltafwm(a0)      Use all bits at left and right edges
  59.             move.l  #screen,bltapt(a0)
  60.             move.l  #screen,bltdpt(a0)
  61. *
  62. bltcmod     equ     sw+$060             Blitter source C modulo
  63. bltbmod     equ     sw+$062             Blitter source B modulo
  64. bltamod     equ     sw+$064             Blitter source A modulo
  65. bltdmod     equ     sw+$066             Blitter destination D modulo
  66. bltcdat     equ     sw+$070             Blitter source C data
  67. bltbdat     equ     sw+$072             Blitter source B data
  68. bltadat     equ     sw+$074             Blitter source A data
  69. *
  70.             move.l  d0,bltamod(a0)      Clear modulo on A and D
  71.             move.l  d0,bltcdat(a0)      Clear data on B and C 
  72.             move.w  #128*64,bltsize(a0) 128x128 bytes=16K, do it
  73. user_mode   andi.w  #$d8ff,sr
  74.             rts                         Return D0 error code in User Mode
  75.             end
  76.  
  77.